#-*- coding = utf-8 -*-
#@Time : 2022/2/28 13:27
#@Author : BAYERN
#@File : test.py
#@software: PyCharm
import requests

headers = {
    'authority': 'www.ncbi.nlm.nih.gov',
    'cache-control': 'max-age=0',
    'sec-ch-ua': '" Not A;Brand";v="99", "Chromium";v="98", "Google Chrome";v="98"',
    'sec-ch-ua-mobile': '?0',
    'sec-ch-ua-platform': '"Windows"',
    'upgrade-insecure-requests': '1',
    'origin': 'https://www.ncbi.nlm.nih.gov',
    'content-type': 'application/x-www-form-urlencoded',
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36',
    'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
    'sec-fetch-site': 'same-origin',
    'sec-fetch-mode': 'navigate',
    'sec-fetch-user': '?1',
    'sec-fetch-dest': 'document',
    'referer': 'https://www.ncbi.nlm.nih.gov/pmc',
    'accept-language': 'zh-CN,zh;q=0.9',
    'cookie': 'ncbi_sid=8A1A03E41D9449E1_0312SID; _ga=GA1.2.1761751111.1641628836; _ga=GA1.4.1761751111.1641628836; pmc.article.report=; books.article.report=; _gid=GA1.2.2056390727.1646020357; _gid=GA1.4.2056390727.1646020357; PRESERVTARGET=%2FtYTXpgzJne16bwfb4ZN2lGInyYoZNk58TVbSvhIR0njSJplCp65%2BiF2SZAktvmmznDxgJBJhBCH%0ANoo2je1cMk0RXykLSXa4UwW7u0%2B%2Fc1X7WzHdCi209NjSVDPLNfOmFzmtz50Uuh6EfD95OQ%2BYQ2B%2B%0Aq7BP3es9s8ArLlZd9XW7NS72Ulu8cigULF%2FZADnu%2FPZf8DmPLOXuV6xWf0fqcNlZXwWhiCjrPJiU%0AU594rDm20QBWFe5y0VjWXnJtzYm7uSPkWDQYJ8htbKyWwjn4aG0xcYfTBSBUTOi9A%2Bo1BnUPHLIi%0A8V9%2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VmhrVU2V3Oj9gkyPbvf+k92aPHldmE8GHBYQacg3vInmLBIc2lQrVrrkhbqVEWUaPymbxV94iq1iGWVig4h+wNBriwA9QtNZUnJECsFNvp14E8B9NP2OzZOcIBC75IY8XB/DALYw5SRnV46dZkG04XJHf00ZD7R2H/gpb52VmR1h+ShfQnt0/qoVbtM5VszPjhIMoqLuCRVxHRphdH0Ha2YYfZQdeZxOuZWua1CED8pZPs7; MyNcbiSigninPreferences=O2dvb2dsZSY%3D; sessionid=eyJzZXR0aW5ncyI6eyJvd25lciI6IjQ3MTY5NzM5N0BxcS5jb20ifX0:1nOXE0:Y0sA7c5eij19XJ5vf2nLIYsRxWjZFZbMcwhcGmErWho; ncbi_prevPHID=CE8CB71521C5ADE10000000000A9002F.m_4; WebCubbyUser=%3Blogged-in%3Dfalse%3Bmy-name%3D%3Bpersistent%3Dfalse%408A1A03E41D9449E1_0312SID; WebEnv=1Jytx5z5rSK9twtFfElhfglnYDGegfLdfnzZekuBMAVA9%408A1A03E41D9449E1_0312SID; _gat_ncbiSg=1; _gat_dap=1; ncbi_pinger=N4IgDgTgpgbg+mAFgSwCYgFwgBwEECMuAnAMIAsAIgEz4kCsx++ADK2+wEJGtcB0AtnHx0QAGhABjADbIJAawB2UAB4AXTKGaZwAQwDmyBTtXIA9gtEnVUqHB0LUCfVAiiARqdWrT/URPOqUAqqfqZSogDOsEFw/lJiIPja/DqG/sFBIQCiwdAAXgBiphD8CQDMRNplAOwAbFriZFpYdETV2AlkZNrSsooq6o0iWA0gZLXaAGY6UlGd1drVZRONHVhl+ESVjZVYOhImMFCiYM5wMgpyokpqCXTNIIheYBEYAPRvAO7fvAoSbshflJ+L9kIheHpTDA3mB+BIAMR3JJYHKqfIAZQAnhFAvwqLwAAqo/KEgCyJEJcLgACUoBEAK5SVQRAn2KBSXjEqB5OCsvQuQnOO5UbQAOQGAAIAHwgAC+4npCikph0qBu6gwoDKZSmMzm4jK3SwaPpUHKaxA5V2IBqtQ6jQerWwKzGRpAiuVqvVnWGiTuEywZBodwWWCS4lqyMSzHGcvE/n4/HM3s1IBFWEy+XK2lhEk62lQpgkDNK4l9CQDIELxfppZAoceqn48XEFqoo2tqCg00Zg0SUZF4nwOrD+FqRCDCyHbtO/NiiHs/ISY+0MxbiQb01mZqHFq3+rTDzwhFIlBo9EYLHY164PCIAiEInEwYzuW5GFzGGrJYwooA8qKWQJFQ6YgN8ny/P8gJKiCChghCULAdawjLOUR61N0BpRihLplKB2BUJhYwjiAzC8GUdC8KMdAkUw+BEXQbrVCBcqykAA=',
}

data = [
  ('term', 'china '),
  ('EntrezSystem2.PEntrez.PMC.Pmc_PageController.PreviousPageName', 'results'),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.EmailTab.EmailReport', ''),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.EmailTab.EmailFormat', ''),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.EmailTab.EmailCount', ''),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.EmailTab.EmailStart', ''),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.EmailTab.EmailSort', ''),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.EmailTab.Email', ''),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.EmailTab.EmailSubject', ''),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.EmailTab.EmailText', ''),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.EmailTab.EmailQueryKey', ''),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.EmailTab.EmailHID', '14A8RHVhGUJASG1rPw8yugq3fotEkcx9YR87gp5cg7'),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.EmailTab.QueryDescription', ''),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.EmailTab.Key', ''),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.EmailTab.Answer', ''),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.EmailTab.Holding', ''),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.EmailTab.HoldingFft', ''),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.EmailTab.HoldingNdiSet', ''),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.EmailTab.OToolValue', ''),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.EmailTab.SubjectList', ''),
  ('EntrezSystem2.PEntrez.PMC.Facets.FacetsUrlFrag', 'filters='),
  ('EntrezSystem2.PEntrez.PMC.Facets.FacetSubmitted', 'false'),
  ('EntrezSystem2.PEntrez.PMC.Facets.BMFacets', ''),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.Pmc_DisplayBar.sPresentation', 'DocSum'),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.Pmc_DisplayBar.sPageSize', '20'),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.Pmc_DisplayBar.sSort', 'none'),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.Pmc_DisplayBar.FFormat', 'DocSum'),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.Pmc_DisplayBar.FSort', ''),
  ('email_format', 'DocSum'),
  ('email_sort', ''),
  ('email_count', '20'),
  ('email_start', '21'),
  ('email_address', ''),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.Pmc_DisplayBar.FileFormat', 'docsum'),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.Pmc_DisplayBar.LastPresentation', 'docsum'),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.Pmc_DisplayBar.Presentation', 'docsum'),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.Pmc_DisplayBar.PageSize', '20'),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.Pmc_DisplayBar.LastPageSize', '20'),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.Pmc_DisplayBar.Sort', ''),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.Pmc_DisplayBar.LastSort', ''),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.Pmc_DisplayBar.FileSort', ''),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.Pmc_DisplayBar.Format', ''),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.Pmc_DisplayBar.LastFormat', ''),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.Pmc_ResultsSearchController.ResultCount', '1169427'),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.Pmc_ResultsSearchController.RunLastQuery', ''),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.Entrez_Pager.cPage', '2'),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.Entrez_Pager.cPage', '2'),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.Entrez_Pager.CurrPage', '3'),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.Pmc_DisplayBar.sPresentation2', 'DocSum'),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.Pmc_DisplayBar.sPageSize2', '20'),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.Pmc_DisplayBar.sSort2', 'none'),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.Pmc_DisplayBar.FFormat2', 'DocSum'),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.Pmc_DisplayBar.FSort2', ''),
  ('email_format2', 'DocSum'),
  ('email_sort2', ''),
  ('email_count2', '20'),
  ('email_start2', '21'),
  ('email_address2', ''),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.Pmc_FilterTab.CurrFilter', 'all'),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.Pmc_FilterTab.LastFilter', 'all'),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.Pmc_MultiItemSupl.Pmc_RelatedDataLinks.rdDatabase', 'rddbto'),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.Pmc_MultiItemSupl.Pmc_RelatedDataLinks.DbName', 'pmc'),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.Discovery_SearchDetails.SearchDetailsTerm', '"china"[MeSH Terms] OR "china"[All Fields]'),
  ('EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.HistoryDisplay.Cmd', 'PageChanged'),
  ('EntrezSystem2.PEntrez.DbConnector.Db', 'pmc'),
  ('EntrezSystem2.PEntrez.DbConnector.LastDb', 'pmc'),
  ('EntrezSystem2.PEntrez.DbConnector.Term', 'china'),
  ('EntrezSystem2.PEntrez.DbConnector.LastTabCmd', ''),
  ('EntrezSystem2.PEntrez.DbConnector.LastQueryKey', '4'),
  ('EntrezSystem2.PEntrez.DbConnector.IdsFromResult', ''),
  ('EntrezSystem2.PEntrez.DbConnector.LastIdsFromResult', ''),
  ('EntrezSystem2.PEntrez.DbConnector.LinkName', ''),
  ('EntrezSystem2.PEntrez.DbConnector.LinkReadableName', ''),
  ('EntrezSystem2.PEntrez.DbConnector.LinkSrcDb', ''),
  ('EntrezSystem2.PEntrez.DbConnector.Cmd', 'PageChanged'),
  ('EntrezSystem2.PEntrez.DbConnector.TabCmd', ''),
  ('EntrezSystem2.PEntrez.DbConnector.QueryKey', ''),
  ('p$a', 'EntrezSystem2.PEntrez.PMC.Pmc_ResultsPanel.Entrez_Pager.Page'),
  ('p$l', 'EntrezSystem2'),
  ('p$st', 'pmc'),
]


def main():
    response = requests.post('https://www.ncbi.nlm.nih.gov/pmc', headers=headers, data=data)
    with open('PMC.html','w',encoding='utf-8') as f:
        f.write(response.text)

if __name__ == '__main__':
    main()